﻿<UserControl xmlns:my="clr-namespace:PersonLookup.View"
             x:Class="PersonLookup.View.PersonsOverview"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="400">

    <Grid x:Name="LayoutRoot"
          Background="White">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="auto"
                              MinWidth="100" />
        </Grid.ColumnDefinitions>
        <ListBox ItemsSource="{Binding Collection}"
                 SelectedItem="{Binding SelectedPerson, Mode=TwoWay}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <my:PersonSummary />
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <StackPanel Grid.Column="1">
            <Button  Content="Get All"
                     Command="{Binding GetAllCommand}"
                     Margin="2" />
            <my:PersonAdd DataContext="{Binding NewPerson}"
                          Margin="2,4,2,2" />
            <Button Command="{Binding AddPersonCommand}"
                    Content="Add Person"
                    Margin="2" />
            <Button Content="Edit Person"
                    Command="{Binding EditPersonCommand}"
                    Margin="2,4,2,2" />
            <my:PersonEdit DataContext="{Binding EditPerson}" />

        </StackPanel>

    </Grid>
</UserControl>
